package java_test;

import java.util.Scanner;

public class title1 {

	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		String string=scanner.nextLine();
		int counts=0;
		if(string.length()==1){
			System.out.println(0);
			scanner.close();
			return ;
		}
		if(string.length()==2){
			if(string.charAt(0)!=string.charAt(1)){
				System.out.println(2);
				scanner.close();
				return ;
			}else{
				System.out.println(0);
				scanner.close();
				return ;
			}
		}
		if(string.charAt(0)!=string.charAt(1))
			counts++;
		if(string.charAt(string.length()-1)!=string.charAt(string.length()-2))
			counts++;
		for(int i=1;i<string.length()-1;i++){
			if(string.charAt(i)!=string.charAt(i-1)||string.charAt(i)!=string.charAt(i+1))
				counts++;
		}
		System.out.println(counts);
		scanner.close();
	}
}
